package ru.dc.gui.swing.util;

import org.apache.commons.io.FileUtils;
import ru.dc.Application;
import ru.dc.object.ServerInfo;

import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import java.awt.*;

/**
 * <pre>
 * User: Penkov Vladimir
 * Date: 02.11.2010
 * Time: 14:29:35
 * </pre>
 */
public class ServerInfoRenderer extends DefaultTableCellRenderer {

    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
        if (value instanceof ServerInfo) {
            label.setText(Application.getApplication().getConnectionManager().getHubName((ServerInfo) value));
        }
        return label;
    }

}
